<template>
  <el-dialog
    title="备注记录"
    :visible.sync="visible"
    width="660px"
    append-to-body
  >
    <el-timeline>
      <el-timeline-item
        v-for="(activity, index) in activities"
        :key="index"
        type="info"
        hide-timestamp
        color="#409EFF"
        placement="top"
      >
        <div>
          {{ activity.createTime }}
          {{ activity.status === '1' ? '审核不通过' : '审核通过' }}
        </div>
        <div>备注：{{ activity.auditRemark }}</div>
      </el-timeline-item>
    </el-timeline>
  </el-dialog>
</template>
<script>
import { getDiaryAuditRemark } from '@/api/core/adopt';
export default {
  props: {
    value: {
      type: Boolean,
      default: false,
    },
    id: {
      type: String,
    },
  },
  data() {
    return {
      activities: [],
    };
  },
  computed: {
    visible: {
      get() {
        return this.value;
      },
      set(val) {
        this.$emit('input', val);
      },
    },
  },
  watch: {
    visible(val) {
      if (val) {
        this.getDiaryAuditRemark();
      } else {
        this.activities = [];
      }
    },
  },
  methods: {
    getDiaryAuditRemark() {
      getDiaryAuditRemark(this.id).then((res) => {
        if (res.data.code === 0) {
          this.activities = res.data.data;
        }
      });
    },
  },
};
</script>
